package com.tedu.feign;

import com.tedu.pojo.Item;
import com.tedu.util.JsonResult;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/11/26
 */
@Component
public class ItemClientFb implements ItemClient{
    @Override
    public JsonResult<List<Item>> getItems(String orderId) {

        if (Math.random()<0.5){
            List<Item> items = new ArrayList<>();
            items.add(new Item(1,"1",1));
            items.add(new Item(2,"2",2));
            items.add(new Item(3,"3",3));
            items.add(new Item(4,"4",4));
            items.add(new Item(5,"5",5));
            return JsonResult.ok(items);
        }
        return JsonResult.err("错误");
    }

    @Override
    public JsonResult<?> decreaseNumber(List<Item> items) {
        return JsonResult.err("错误");
    }
}
